package com.wench.design.pattern.observer;

/**
 * @author wench
 */
public class ObserverClient {

    public static void main(String[] args) {
        SubscriptionSubject mSubscriptionSubject = new SubscriptionSubject();
        //创建微信用户
        WeChatUser user1 = new WeChatUser("孙悟空");
        WeChatUser user2 = new WeChatUser("猪悟能");
        WeChatUser user3 = new WeChatUser("沙悟净");
        //订阅公众号
        mSubscriptionSubject.attach(user1);
        mSubscriptionSubject.attach(user2);
        mSubscriptionSubject.attach(user3);
        //公众号更新发出消息给订阅的微信用户
        mSubscriptionSubject.notify("传智黑马的专栏更新了");
    }
}
